package com.example.grape_effect.gl.common

import com.example.grape_effect.gl.glHelper.TextureHelper

class ByteTexture :Texture() {
    val rgba = 0
    val yuv420 = 1
    val nv21 = 2
    val nv12 = 3
    private var byteFormat = 0
    private var bytes: ByteArray? = null

    fun setByte(bytes:ByteArray, width:Int, height:Int,  pixFormat:Int) {
        byteFormat = pixFormat
        this.width = width
        this.height = height
        this.bytes = bytes
    }

    override fun prepareToDraw() {
        var texture = IntArray(1);
        bytes?.let {
            textureId = TextureHelper.createTexture(it, texture, width, height)
        }
          bytes = null;
    }

}